package com.zwy.space.controller;

import com.zwy.space.queryVo.BlogDetailVo;
import com.zwy.space.queryVo.BlogVo;
import com.zwy.space.service.BlogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/blog")
public class BlogController {
    @Autowired
    private BlogService blogService;


    @RequestMapping("/{blogId}")
    public String getBlogDetail(@PathVariable int blogId, Model model){

        BlogDetailVo blogDetailVo=blogService.findBlogById(blogId);
        model.addAttribute("blog",blogDetailVo);
        return "blog";
    }



}
